<%@page import="library.dto.WishlistDTO"%>
<%@page import="library.dto.RentDTO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
<%@page import="library.dto.MemberDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>우편번호찾기</title>																
</head>
<body>
<form name="registerForm" method="post" action="" enctype="multipart/form-data">	<!-- /${initParam.context_root }/modifyMember.do -->
<%
	MemberDTO mdto = (MemberDTO)session.getAttribute("login_info"); 
	String hp = mdto.getHp();
%>
	<table border="1">
		  <tr>
			    <td rowspan="4" align="center">
			    	<img src="C:\apache-tomcat-6.0.35\webapps\member_springmvc_fileup\pictures\<%=mdto.getPictureFilename()%>">
			     </td>
			    <td width="114" bgcolor="#FF9473"> 회원ID</td>
			    <td width="412"><%=mdto.getId() %></td> 
	  	</tr>
	  	<tr>
			    <td  bgcolor="#FF9473"> 이름</td>
				<td><%=mdto.getName()%></td>
	  	</tr>
	  	<tr>
	  			<td bgcolor="#FF9473">주민등록번호</td>
				<td colspan="2"> <%=mdto.getRegisterNumber1() %> - ●●●●●●</td>
	  	</tr>
	 	 <tr>
	    		<td bgcolor="#FF9473">상태</td>
	  			<td><%if(mdto.getState_no() == 0){ %>
	  							정상
	  					<%}else if(mdto.getState_no()==1){ %>
	  							대여불가
	  					<%}else{ %>
	  							이용정지  
	  					<%} %>
	  			</td>
	  	</tr>
		<tr>
			<td  bgcolor="#FF9473">휴대전화번호</td>
			<td colspan="2">
					<%=hp.substring(0, 3) %>
					<% if(hp.length() >10){ %>
						- <%=hp.substring(3,7) %> - <%=hp.substring(7,11) %>
					<%} else{%>
						- <%=hp.substring(3,6) %> - <%=hp.substring(6,10) %>
					<%} %>
			</td>
		</tr>
		<tr>
			<td  bgcolor="#FF9473">이메일</td>
			<td colspan="2"><%=mdto.getEmail() %></td>
		</tr>
		  <tr>
			    <td rowspan="3"  bgcolor="#FF9473">주소</td>
			    <td colspan="2"><%=mdto.getZipcode() %></td>
		 </tr>
		 <tr>
			    <td colspan="2"><%=mdto.getAddress1() %></td>
		 </tr>
		 <tr>
			    <td colspan="2"><%=mdto.getAddress2() %></td>
		</tr>
	</table>
  대여현황<br>
  	<table border="1">
  		<tr>
  			<td>NO</td>
  			<td>도서명</td>
  			<td>대여일</td>
  			<td>반납일</td>
  			<td>연장횟수</td>
  		</tr>
  				<%
  					HashMap map = (HashMap)session.getAttribute("book_list");
  					ArrayList<RentDTO> rentbook =(ArrayList<RentDTO>) map.get("rentbook");
  					ArrayList<WishlistDTO> wishbook = (ArrayList<WishlistDTO>)map.get("wishbook");
  					ArrayList<RentDTO> reservationbook = (ArrayList<RentDTO>)map.get("reservationbook");
  				%>
  			  	<%for(int idx=0; idx < rentbook.size() ; idx++) { %>
					<tr align="center">
						<td><%=(idx+1) %></td>
  						<td><%=rentbook.get(idx).getBookName() %></td>
  						<td><%=rentbook.get(idx).getBookRentDate() %></td>
  						<td><%=rentbook.get(idx).getBookReturnDate() %></td>
  						<td><%=rentbook.get(idx).getExtensionCount() %></td>
					</tr>  			  			
  			  	<%} %>
  	</table>
  	예약도서<br>
  	<table border="1">
  		<tr>
  			<td>NO</td>
  			<td>도서명</td>
  			<td>예약일</td>
  			<td>유효기간</td>
  		</tr>
  			  	<%for(int idx=0; idx < reservationbook.size() ; idx++) { %>
					<tr align="center">
						<td><%=(idx+1) %></td>
  						<td><%=reservationbook.get(idx).getBookName() %></td>
  						<td><%=reservationbook.get(idx).getBookRentDate() %></td>
  						<td><%=reservationbook.get(idx).getBookReturnDate() %></td>
					</tr>  			  			
  			  	<%} %>
  	</table>
  	희망도서<br>
  	<table border="1">
  		<tr>
  			<td>NO</td>
  			<td>희망도서명</td>
  			<td>출판사</td>
  			<td>저자</td>
  		</tr>
  			  	<%for(int idx=0; idx < reservationbook.size() ; idx++) {%>
					<tr align="center">
						<td><%=(idx+1) %></td>
  						<td><%=wishbook.get(idx).getWishName() %></td>
  						<td><%=wishbook.get(idx).getWishPublisher() %></td>
  						<td><%=wishbook.get(idx).getWishWriter() %></td>
					</tr>  			  			
  			  	<%} %>
  	</table>
</form>
</body>
</html>

